﻿using Core.Interface;
using Prism.Ioc;
using Prism.Modularity;
using ProcessControl.ViewModels;
using ProcessControl.Views;
using System;
using System.Windows;

namespace ProcessControl
{
    public class ProcessControlModule : IModule
    {
        public void OnInitialized(IContainerProvider containerProvider)
        {
        }
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            try
            {
                //实例对象 使用GetType  类型 使用typeof
                containerRegistry.RegisterSingleton(typeof(IAutoProcess), typeof(AutoProcess));

                containerRegistry.RegisterSingleton(typeof(YieldViewModel));
                containerRegistry.RegisterSingleton(typeof(DisplayDataViewModel));
                //注册导航
                containerRegistry.RegisterForNavigation<HomePageView>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }          
        }
    }
}
